<?php
/**
 * Created by jinqiang on 2024/12/2 10:11.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Callback;


use App\Http\Controllers\Controller;
use App\Http\Services\Callback\WmsService;
use Illuminate\Http\Request;

class WmsController extends Controller
{
    //调拨回写
    public function allocation(Request $request, WmsService $wmsService)
    {
        $param = $request->all();
        info("调拨回写", [$param]);
        $res = $wmsService->allocation($param);
        return $res['code'] === 0 ? success() : error($res['msg'], $res);
    }

    //加工单异常完结回写
    public function processing(Request $request, WmsService $wmsService)
    {
        $param = $request->all();
        info("加工单手动完结回写", [$param]);
        $res = $wmsService->processing($param);
        return $res['code'] === 0 ? success() : error($res['msg'], $res);
    }

    //拉取回货单--ibox上传数据后调用
    public function pullReturnOrder()
    {
        $cmd = 'php '.base_path()."/artisan command:pullReturnsOrder --sleep=5 2>&1 &";
        ppopen($cmd);
        return success();
    }
}
